﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AppDesigner.XamlDom
{
    public delegate object CreateInstanceCallback(Type type, params object[] arguments);

    /// <summary>
    /// Parse Setting for XamlParser
    /// </summary>
    public class XamlParserSettings
    {
        #region Fields

        private CreateInstanceCallback _createInstanceCallback = Activator.CreateInstance;
        private IServiceProvider _serviceProvider = new CommonsServiceProvider();

        #endregion

        public XamlParserSettings()
        {
            this.XamlErrorService = new XamlErrorService();
        }

        #region Properties

        public CreateInstanceCallback CreateInstanceCallback
        {
            get { return _createInstanceCallback; }
            set { _createInstanceCallback = value; }
        }

        public IServiceProvider ServiceProvider
        {
            get { return _serviceProvider; }
            set { _serviceProvider = value; }
        }

        public IXamlErrorService XamlErrorService { get; private set; }
        #endregion

    }

    public sealed class CommonsServiceProvider : IServiceProvider
    {
        public object GetService(Type serviceType)
        {
            return null;
        }
    }
}
